FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

inherit systemd

SRC_URI += "\
    file://PHYTIUM-MIB.mib \
    file://snmpd.conf \
    file://ft-mib.h \
    file://ft-mib/ftserverBMCNetworkConfTable.c \
    file://ft-mib/ftserverBMCNetworkConfTable.h \
    "

#Build-time dependency
DEPENDS += "\
    openssl \
    systemd \
    "

#Add OEM mib file to snmp
do_configure:prepend() {
    cp -f ${WORKDIR}/ft-mib.h ${S}/agent/mibgroup
    cp -r ${WORKDIR}/ft-mib ${S}/agent/mibgroup
}

SYSTEMD_SERVICE_${PN} = "snmpd.service"

CFLAGS:prepend = "-I${WORKDIR}/recipe-sysroot/usr/include/systemd "
LDFLAGS += "-L${WORKDIR}/recipe-sysroot/lib -lsystemd"

MIB_MODULES += "ft-mib"
EXTRA_OECONF += "\
    --with-default-snmp-version="3" \
    --with-logfile="/var/log/snmpd.log" \
    --enable-privacy \
    --enable-md5 \
    --enable-daemons-syslog-as-default \
    "
do_install:append() {
    install -d ${D}${sysconfdir}/snmp
    install -m 0644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp
    install -m 0644 ${WORKDIR}/PHYTIUM-MIB.mib ${D}/usr/share/snmp/mibs
}
